<%-- 首页滚动广告Portal显示列表 --%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri= "http://java.sun.com/jsp/jstl/core" prefix= "c" %>
<%@taglib uri= "/WEB-INF/tld/fn.tld" prefix= "fn" %>

<table border="0" cellSpacing=0 cellPadding=0 style="width: 690; padding-right: 0px">
    <tr>
      <td>
        <c:if test="${not empty requestScope.fullColAdLst}">
        <a onmouseover="displayStatusMsg(); return document.returnvalue"
           href="javascript:jump2url()">
          <img class="img" style="FILTER: revealTrans(duration=2,transition=20)" height=230 
            src="" width=690 name=bannerADrotator>
        </a>
        </c:if>
        <c:if test="${empty requestScope.fullColAdLst}">暂无图片</c:if>
      </td>
    </tr>
</table>

<c:if test="${not empty requestScope.fullColAdLst}">
<script type="text/javascript">
    // 用来放置图片URL
    var bannerAD=new Array();
    
    // 用来放置链URL
    var bannerADlink=new Array();
    var altInfo = new Array();
    
    var adNum=0;
    // 图片的数量
    var imgNum = '${fn:length(requestScope.fullColAdLst)}';
    // alert("[picture.jsp -- js] 查询到的图片数量 = " + imgNum);
    
    // 给每幅新闻图片设置　路径　和　链接
    <c:forEach items="${requestScope.fullColAdLst }" var="fullColAdItem" varStatus="status">
        bannerAD[<c:out value="${status.index}" />]="./resource/uploadimg/${fullColAdItem.srcUrl}";
        bannerADlink[<c:out value="${status.index}" />]="./adDetail.do?id=${fullColAdItem.id}";
        altInfo[<c:out value="${status.index}" />]="${fullColAdItem.altInfo}";
    </c:forEach>
    
    var preloadedimages = new Array();
    for (var i=1; i<bannerAD.length;i++){
        preloadedimages[i]=new Image();
        preloadedimages[i].src=bannerAD[i];
    }
    
    function setTransition(){
    	if (document.all){
    		bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);    
            bannerADrotator.filters.revealTrans.apply();    
        }
    }
    
    function playTransition(){
    	if (document.all) {
    		bannerADrotator.filters.revealTrans.play();
    	}
    }
    
    function nextAd(){
    	if(adNum<bannerAD.length-1){ 
    		adNum++ ;
    	} else {
    		adNum=0;
    	}
    	
    	setTransition();
    	document.images.bannerADrotator.src=bannerAD[adNum];
    	document.images.bannerADrotator.title=altInfo[adNum];
        
    	playTransition();
    	theTimer=setTimeout("nextAd()", 5000);
    }
    
    function jump2url(){
    	jumpUrl=bannerADlink[adNum];
    	jumpTarget='_blank';
    	if (jumpUrl != ''){
    		if (jumpTarget != '') {
    			window.open(jumpUrl,jumpTarget);
    	    } else {
    	    	location.href=jumpUrl;
            }
        }
    }
    
    function displayStatusMsg() {
    	status=bannerADlink[adNum];
    	document.returnvalue = true;
    }
    
    function MM_openBrWindow(theURL,winName,features) {
    	window.open(theURL,winName,features);
    }
     //-->
</script>
        
<script type="text/javascript">
    nextAd();
</script>
</c:if>
